package com.hmall.api.domain.dto;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.NumberDeserializers;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Schema(description = "索引库实体")
public class ItemDoc {

    @Schema(title = "商品id")
    private String id;

    @Schema(title = "商品名称")
    private String name;

    @Schema(title = "价格（分）")
    private Integer price;

    @Schema(title = "库存")
    private Integer stock;

    @Schema(title = "商品图片")
    private String image;

    @Schema(title = "类目名称")
    private String category;

    @Schema(title = "品牌名称")
    private String brand;

    @Schema(title = "销量")
    private Integer sold;

    @Schema(title = "评论数")
    private Integer commentCount;

    @Schema(title = "是否是推广广告，true/false")
    private Boolean isAD;

    @Schema(title = "更新时间")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime updateTime;
}